Java Program Compilaton on Windows [closed]

Posted by Mc Elroy on Programmers See other posts from Programmers or by Mc Elroy
Published on 2012-12-03T16:16:01Z Indexed on 2012/12/03 17:18 UTC
Read the original article Hit count: 180

Filed under:

I am trying to compile my program on the command line on windows using the java command and it says:

Error: could not find or load main class or addition class

It is for a program for adding two integers. I don't understand how to resolve the problem since I defined the static main class in my source code here is it:

//Filename:addition.java
//Usage: this program adds two numbers and displays their sum.
//Author: Nyah Check, Developer @ Ink Corp..
//Licence: No warranty following the GNU Public licence

import java.util.Scanner; //this imports the scanner class.

public class addition
{
    public static void main(String[] args)
    {
        Scanner input = new Scanner(System.in);//this creates scanners instance to take input from the input.
        int input1, input2, sum;

        System.out.printf("\nEnter First Integer: ");
        input1 = input.nextInt();

        System.out.printf("\nEnter Second Integer: ");
        input2 = input.nextInt();

        sum = input1 + input2;

        System.out.printf("\nThe Sum is: %d", sum);

    }

}//This ends the class definition

© Programmers or respective owner

Related posts about java